package com.jf.identity.holder;

import com.jf.identity.entity.OrgCode;
import org.springframework.stereotype.Component;

/**
 * 当前线程储存orgCode
 *
 * @author FCG
 */
@Component
public class OrgCodeHolder {
    private volatile ThreadLocal<OrgCode> threadLocal = new ThreadLocal<>();

    public OrgCode getOrgCode() {
        return threadLocal.get();
    }

    public void setOrgCode(OrgCode orgCode) {
        threadLocal.set(orgCode);
    }

    public void remove() {
        threadLocal.remove();
    }
}
